package org.wk.common.jpush.vo;

import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.audience.Audience;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.wk.common.jpush.PushConstant;

/**
 * @author df.wu
 * @version V1.0
 * @title: CustomPush
 * @package com.athena.base.service.vo
 * @Date 20:18 2017/11/23
 * @description: 自定义通知
 */
public class CustomPush {

    /**
     * 推送到的平台
     */
    private String platform ;

    /**
     * 推送目标
     */
    private Audience audience;

    /**
     * 推送通知
     */
    private CustomNotification notification;
    /**
     * 推送消息
     */
    private CustomMessage message;

    private Options options=Options.newBuilder().build();

    public CustomPush(String platform, Audience audience, CustomNotification notification) {
        this.platform = platform;
        this.audience = audience;
        this.notification = notification;
        this.options.setApnsProduction(PushConstant.ios_env);
    }

    public CustomPush(String platform, Audience audience, CustomMessage message) {
        this.platform = platform;
        this.audience = audience;
        this.message = message;
        this.options.setApnsProduction(PushConstant.ios_env);
    }

    public CustomPush(String platform, Audience audience, CustomNotification notification, CustomMessage message) {
        this.platform = platform;
        this.audience = audience;
        this.notification = notification;
        this.message = message;
        this.options.setApnsProduction(PushConstant.ios_env);
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public Audience getAudience() {
        return audience;
    }

    public void setAudience(Audience audience) {
        this.audience = audience;
    }

    public CustomNotification getNotification() {
        return notification;
    }

    public void setNotification(CustomNotification notification) {
        this.notification = notification;
    }

    public CustomMessage getMessage() {
        return message;
    }

    public void setMessage(CustomMessage message) {
        this.message = message;
    }

    public final String toJSONString() {
        return JSON.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect);
    }


}
